package com.piggy.logi.sys.mapper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.piggy.common.core.utils.sql.SqlUtil;
import com.piggy.common.core.web.page.BaseMapperPlus;
import com.piggy.logi.sys.domain.LogiCustomer;

/**
 * 我的客户Mapper接口
 *
 * @author piggy
 * @date 2023-08-16
 */
public interface LogiCustomerMapper extends BaseMapperPlus<LogiCustomer> {

    default LogiCustomer findByUk(Long mainDeptId, String customerCode) {
        return selectOne(Wrappers.<LogiCustomer>lambdaQuery().eq(LogiCustomer::getCustomerCode, customerCode)
                .apply(SqlUtil.getDataPermissionSql(mainDeptId))
                .last("limit 1"));
        //.eq(LogiCarrierDriver::getDeptId, deptId).last("limit 1"));
    }

}
